#ifndef PD_EVENT_H_
#define PD_EVENT_H_

#include "pd_define.h"

PD_CPP_START

typedef struct PdIOEvent
{
    int readable;
    int writeable;
    int error;
    PdIOComponent *ioc;
} PdIOEvent;

struct PdSocketEvent;
typedef struct PdSocketEvent PdSocketEvent;

extern PdSocketEvent *pd_event_init();

extern void pd_event_destroy(PdSocketEvent *ev);

extern int pd_event_add_event(PdSocketEvent *ev, PdIOComponent *ioc, int enable_read, int enable_write);

extern int pd_event_set_event(PdSocketEvent *ev, PdIOComponent *ioc, int enable_read, int enable_write);

extern int pd_event_remove_event(PdSocketEvent *ev, PdIOComponent *ioc);

extern int pd_event_get_events(PdSocketEvent *ev, int timeout_us, PdIOEvent *events, int events_cnt);

PD_CPP_END

#endif
